// ignore_for_file: file_names, slash_for_doc_comments

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/**图片util */
class FFImageUtil {

  static String utilDefaultNetImage = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp09%2F210Q6133S9A22-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1663494430&t=2cf3d8343ba0621295621ea05e83626e";

  /**
   * 网络图片
   */
  static CachedNetworkImage utilNetworkImage(String url,{BoxFit? fit=BoxFit.cover,}) {
    return CachedNetworkImage(
      fit: fit,
      imageUrl: url,
      placeholder: (context, url) {
        return Container(
          alignment: Alignment.center,
          color: Colors.red,
        );
      },
      errorWidget: (context, url, error) => Center(
        child: Expanded(
          flex: 1,
          child: Container(
            color: Colors.red,
          ),
        ),
      ),
    );
  }
}
